package main

import (
	"fmt"
	"os"
	"os/signal"
	"time"
)

func f() {

	s := []int{1, 2, 3}
	fmt.Println(s[1:])
}

func main() {
	f()
	return
	// 创建一个退出通道，用于接收中断信号
	exitChan := make(chan os.Signal, 1)
	signal.Notify(exitChan, os.Interrupt)

	// 创建一个定时器，每隔一秒触发一次
	ticker := time.NewTicker(time.Second)

	fmt.Println("Started. Press Ctrl+C to exit.")

	for {
		select {
		case <-ticker.C:
			fmt.Println("Timer event")

		case <-exitChan:
			fmt.Println("Received interrupt signal. Exiting...")
			// 执行清理工作
			ticker.Stop()
			return
		}
	}
}
